﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using CrossRoadNS.Model;
using System.Windows.Media;

namespace CrossRoadNS.Services.Converters
{
    class CellStaticStateToColorConv : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            SolidColorBrush result = new SolidColorBrush();
            CellState stateValue = (CellState)value;

            //if (stateValue.Contains(CellState.Inaccessible))
            //    result.Color = Colors.LightGreen;
            //else if (stateValue.Contains(CellState.Start))
            //    result.Color = Colors.Red;
            //else if (stateValue.Contains(CellState.Finish))
            //    result.Color = Colors.Blue;
            //else
            //    result.Color = Colors.LightGray;

            switch (stateValue)
            {
                case CellState.None:
                    result.Color = Colors.LightGray;
                    break;
                case CellState.Inaccessible:
                    result.Color = Colors.LightGreen;
                    break;
                case CellState.Start:
                    //result.Color = Colors.LightBlue;
                    result.Color = Colors.LightGray;
                    break;
                case CellState.Finish:
                    //result.Color = Colors.Blue;
                    result.Color = Colors.LightGray;
                    break;
                default:
                    break;
            }

            return result;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
